package mya.mes.mdc.model.tag;


import mya.mes.mdc.model.tag.util.KeyBuilder;

import java.util.HashMap;

public class SectionMap {

  public static HashMap<String, String> map = new HashMap();

  private final static SectionMap _instance = new SectionMap();


  private SectionMap() {

  }

  public static SectionMap getInstance() {
    return _instance;
  }

  public String getSection(String key) {
    return map.get(key);
  }


  public void init() {

    initBD1();
    initBD4();
    initBD6();

    initBD7();
    initStack();
    initBFG();
    initEMS();
  }

  private void initMap(String shop, String area, String[] array) {
    String section = KeyBuilder.key(shop, area, area);
    for (String point : array) {

      String key = KeyBuilder.key(shop, area, point);

      map.put(key, section);

    }
  }

  private void initBD1() {
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION1);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION2);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION3);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION4);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION5);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION6);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION7);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION8);
    initMap("CUR", "BD1", SectionMapDef.CUR_BD1_SECTION9);
  }

  private void initBD4() {
    initMap("CUR", "BD4", SectionMapDef.CUR_BD4_SECTION1);
    initMap("CUR", "BD4", SectionMapDef.CUR_BD4_SECTION2);
    initMap("CUR", "BD4", SectionMapDef.CUR_BD4_SECTION3);
    initMap("CUR", "BD4", SectionMapDef.CUR_BD4_SECTION4);
  }

  private void initBD6() {
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION1);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION2);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION3);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION4);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION5);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION6);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION7);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION8);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION9);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION10);
    initMap("CUR", "BD6", SectionMapDef.CUR_BD6_SECTION11);
  }

  private void initBD7() {
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION1);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION2);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION3);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION4);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION5);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION6);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION7);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION8);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION9);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION10);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION11);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION12);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION13);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION14);

    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION15);

    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION16);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION17);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION18);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION19);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION20);
    initMap("CUR", "BD7", SectionMapDef.CUR_BD7_SECTION21);

  }

  private void initStack() {
    initMap("CUR", "STACK1", SectionMapDef.CUR_STACK1);
    initMap("CUR", "STACK2", SectionMapDef.CUR_STACK2);
    initMap("CUR", "STACK3", SectionMapDef.CUR_STACK3);
    initMap("CUR", "STACK4", SectionMapDef.CUR_STACK4);
  }

  private void initBFG() {
    initMap("CUR", "BFG1", SectionMapDef.CUR_BFG1);
    initMap("CUR", "BFG2", SectionMapDef.CUR_BFG2);
    initMap("CUR", "BFG3", SectionMapDef.CUR_BFG3);
    initMap("CUR", "BFG4", SectionMapDef.CUR_BFG4);
  }

  private void initEMS() {
    map.put("CUR_EMS1_EMS","CUR_EMS1_SECTION1");
    map.put("CUR_EMS2_EMS","CUR_EMS2_SECTION1");
    map.put("CUR_EMS3_EMS","CUR_EMS3_SECTION1");
    map.put("CUR_EMS4_EMS","CUR_EMS4_SECTION1");
    map.put("CUR_EMS6_EMS","CUR_EMS6_SECTION1");
  }
}
